# ifndef BINARYTREE_H
# define BINARYTREE_H

# include<iostream>

template <typename DT>
class Node{
	private:
		DT data;
	public:
		virtual DT getdata() const {return data;} 
		virtual void setdata(DT _val) {data = _val;}
		Node(DT _val) {data = _val;}		
};

template <typename DT>
class BinaryTree{
	private:
		class BiNode : public Node<DT>{
			private:
				BiNode* prev;
				BiNode* next;
			public:
				virtual BinNode* getprev(){
					return prev;
				}
				virtual BinNode* getnext(){
					return next;
				}
				virtual void setprev(BiNode* _nt){
					prev = _nt;
				}
				virtual void setnext(BiNode* _nt){
					next = _nt;
				}
				BiNode(DT _val) : Node<DT>(_val) {// guarantee the calling order
					prev = nullptr;
					next = nullptr;
				}
		};
		
		BiNode<DT>* root;
		
	public:
		virtual void insert( DT & _val ) = 0;
		virtual void insert( DT && _val ) = 0;
		virtual void remove( DT & _val ) = 0;
		virtual bool contains( const DT & _val ) const = 0;
	
};

# endif
